﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Web;
using System.Web.Routing;
using JXT.PrimaryKey.Batman.Core.Configuration;
using JXT.PrimaryKey.Batman.Language;

namespace JXT.PrimaryKey.Batman.Core.Infrastructure
{
    public class SupernovaContext
    {
        public SupernovaContext(ILanguage language)
        {
            if (Configuration == null || Configuration.Language == null)
            {
                CultureInfo = CultureInfo.CurrentCulture;
            }
            else
            {
                CultureInfo = Configuration.Language;
            }
            Language = language;
        }

        public ILanguage Language { get; private set; }

        public CultureInfo CultureInfo { get; private set; }

        private ServiceConfigurationSection _configuration;
        public ServiceConfigurationSection Configuration
        {
            get
            {
                if (_configuration == null)
                {
                    _configuration = SupernovaConfigurationManager.GetServiceConfigurationSection();
                }
                return _configuration;
            }
        }
    }
}
